<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bootstrap Material Admin by Bootstrapious.com</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
  </head>
  <body>
    <div class="page">
      <div class="page-content d-flex align-items-stretch"> 
        <!-- Side Navbar -->
        <div class="content-inner">
          <!-- Page Header-->
          <header class="page-header">
            <div class="container-fluid">
              <h2 class="no-margin-bottom">Raw json submit</h2>
            </div>
          </header>
          <!-- Breadcrumb-->
          <div class="breadcrumb-holder container-fluid">
            <ul class="breadcrumb">
              <li class="breadcrumb-item"><a href="index.html">Home</a></li>
              <li class="breadcrumb-item active">Raw json submit            </li>
            </ul>
          </div>
          <section class="tables">   
            <div class="container-fluid">
                <form role="form">
                    <div class="row">
                        <div class="col-lg-6">
                           <div class="pie-chart-example card">
                             <div class="card-header d-flex align-items-center">
                                 <h3 class="h4">Submit Json String</h3>
                             </div>
                             <div class="card-close align-items-center">
                                  <button type="button" class="btn btn-primary" onclick="submit_request();">Submit</button>
                                  <button type="button" class="btn btn-primary" onclick="clear_json();">Clean</button>
                             </div>
                             <div class="card-body">
                                 <textarea id="request_json" class="form-control" rows="20"></textarea>
                             </div>
                           </div>
                        </div>
                        <div class="col-lg-6">
                           <div class="pie-chart-example card">
                             <div class="card-header d-flex align-items-center">
                                 <h3 class="h4">Response</h3>
                             </div>
                             <div class="card-body">
                                 <textarea id="response_json" class="form-control" rows="20"></textarea>
                             </div>
                           </div>
                        </div>
                    <div>
                </form>
            </div>
          </section>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/popper.js/umd/popper.min.js"> </script>
    <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="vendor/jquery.cookie/jquery.cookie.js"> </script>
    <script src="vendor/chart.js/Chart.min.js"></script>
    <script src="vendor/jquery-validation/jquery.validate.min.js"></script>
    <!-- Main File-->
    <script src="js/front.js"></script>
    <script type="text/javascript"> 
        function submit_request() {
            var request_json_str = $('#request_json').val();
            //var js =  JSON.parse(request_json_str);
            $.post("/thunder-trader", 
                request_json_str,
                function(data){
                    $('#response_json').val(data);
                    },"text"
            );
        };
        function clear_json() {
            $('#request_json').val('');
        };
     
    </script>
  </body>
</html>
